package com.nanbei.a03;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;


/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: libs
 * @Created: 2024/9/10 16:12
 */
@Component
@Slf4j
public class LifeCycleBean {

    public LifeCycleBean(){
        log.info("构造");
    }

    @Autowired
    public void autowire(@Value("${JAVA_HOME}") String name){
        log.info("依赖注入{}",name);
    }

    // 初始化方法
    @PostConstruct
    public void init(){
        log.info("初始化");
    }

    //销毁方法
    @PreDestroy
    public void destroy(){
        log.info("销毁");
    }
}
